home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Peter Lewis / Morpion 1.0.0 / source / PNL Libraries / MyMathUtils.unit < prev    next >
Encoding:
Text File  |  1993-10-15  |  725 b   |  48 lines  |  [TEXT/PJMM]

  1. unit MyMathUtils;
  2.  
  3. interface
  4.  
  5.     function Max (a, b: longInt): longInt;
  6.     function Min (a, b: longInt): longInt;
  7.     function Pin (a, b, c: longInt): longInt;
  8.     function Choose (cond: boolean; a, b: longInt): longInt;
  9.  
  10. implementation
  11.  
  12.     function Max (a, b: longInt): longInt;
  13.     begin
  14.         if a > b then
  15.             Max := a
  16.         else
  17.             Max := b;
  18.     end;
  19.  
  20.     function Min (a, b: longInt): longInt;
  21.     begin
  22.         if a < b then
  23.             Min := a
  24.         else
  25.             Min := b;
  26.     end;
  27.  
  28.     function Pin (a, b, c: longInt): longInt;
  29.     begin
  30.         if b < a then
  31.             Pin := a
  32.         else if b > c then
  33.             Pin := c
  34.         else
  35.             Pin := b;
  36.     end;
  37.  
  38.     function Choose (cond: boolean; a, b: longInt): longInt;
  39.     begin
  40.         if cond then begin
  41.             Choose := a;
  42.         end
  43.         else begin
  44.             Choose := b;
  45.         end;
  46.     end;
  47.  
  48. end.